package cn.glc.daily.life.web.controller.manageapi;

import cn.glc.daily.life.common.constans.Developers;
import cn.glc.daily.life.common.utils.JsonResult;
import cn.glc.daily.life.model.dto.dict.DictDto;
import cn.glc.daily.life.web.service.dict.DictService;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 字典相关
 *
 * @author simon
 * @date 2021/4/13 12:00
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
@Slf4j
@RestController
@RequestMapping(value = "/dict")
@AllArgsConstructor(onConstructor = @__(@Autowired))
public class DictController {

    private final DictService dictService;

    @ApiOperation(value = "分页查询字典列表", notes = Developers.CY)
    @PostMapping(value = "/listPage")
    public JsonResult listPage(@Valid @RequestBody DictDto dictDto) {
        return JsonResult.of(dictService.listPage(dictDto));
    }
}
